package first.chapter2.scope;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Description: 类作用描述
 * @Author: ChenZhiXiang
 * @CreateDate: 2019/5/8 0008 14:51
 * @Version: 1.0
 */
public class Demo02Main {

    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(Demo02Config.class);
        SingletonDemo singletonDemo = context.getBean(SingletonDemo.class);
        SingletonDemo singletonDemo1 = context.getBean(SingletonDemo.class);
        System.out.println("Singleton:"+(singletonDemo == singletonDemo1));

        PrototypeDemo prototypeDemo = context.getBean(PrototypeDemo.class);
        PrototypeDemo prototypeDemo1 = context.getBean(PrototypeDemo.class);
        System.out.println("Prototy:"+(prototypeDemo == prototypeDemo1));
    }
}
